data.cor <- cor(county.Demo_and_Covid.allcounties[,-1], use = "complete.obs", method = "spearman")
corrplot.mixed(data.cor, upper = 'ellipse', lower = 'number', tl.pos = 'lt', tl.cex = 1, lower.col = "black", number.cex = 0.5)
data.cor2 <- cor(county.Demo_and_Covid.500counties[,-c(1:2)], use = "complete.obs", method = "spearman")
corrplot.mixed(data.cor2, upper = 'ellipse', lower = 'number', tl.pos = 'lt', tl.cex = 1, lower.col = "black", number.cex = 0.5)
corrplot.mixed(data.cor2[7:13,c(1:5, 14:42,6)], upper = 'ellipse', tl.pos = 'lt', tl.cex = 1, lower.col = "black", number.cex = 0.5)
this.lme <- lmer("total.cases.percap ~ Affluence + Singletons.in.Tract + Seniors.in.Tract + African.Americans.in.Tract + Noncitizens.in.Tract + High.BP + Binge.Drinking + Cancer + Asthma + Heart.Disease + COPD + Smoking + Diabetes + No.Physical.Activity + Obesity + Poor.Sleeping.Habits + Poor.Mental.Health + Testing_Rate + Hospitalization_Rate + (1 | stateID)", data = county.Demo_and_Covid.500counties)
## Warning: Some predictor variables are on very different scales: consider rescaling
## Warning: Some predictor variables are on very different scales: consider rescaling
print(summary(this.lme), correlation=TRUE)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method ['lmerModLmerTest']
## Formula:
## "total.cases.percap ~ Affluence + Singletons.in.Tract + Seniors.in.Tract + African.Americans.in.Tract + Noncitizens.in.Tract + High.BP + Binge.Drinking + Cancer + Asthma + Heart.Disease + COPD + Smoking + Diabetes + No.Physical.Activity + Obesity + Poor.Sleeping.Habits + Poor.Mental.Health + Testing_Rate + Hospitalization_Rate + (1 | stateID)"
## Data: county.Demo_and_Covid.500counties
##
## REML criterion at convergence: -1265.8
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -3.3878 -0.3591 -0.0466 0.2773 5.6894
##
## Random effects:
## Groups Name Variance Std.Dev.
## stateID (Intercept) 0.000006197 0.002489
## Residual 0.000016188 0.004023
## Number of obs: 192, groups: stateID, 35
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) -0.0117106494 0.0118667844 99.0011361801 -0.987 0.32613
## Affluence 0.0048885399 0.0012129321 145.4756772471 4.030 0.0000895 ***
## Singletons.in.Tract 0.0008676797 0.0010247490 171.9691647702 0.847 0.39833
## Seniors.in.Tract 0.0004380509 0.0013341227 171.7586145081 0.328 0.74305
## African.Americans.in.Tract 0.0012799548 0.0011320502 171.9701722405 1.131 0.25978
## Noncitizens.in.Tract 0.0018531560 0.0008729306 152.8832255211 2.123 0.03537 *
## High.BP -0.0000093968 0.0002157825 155.1713100731 -0.044 0.96532
## Binge.Drinking 0.0003726595 0.0002056043 72.6758125740 1.813 0.07404 .
## Cancer -0.0020198774 0.0012874818 146.2436255139 -1.569 0.11884
## Asthma 0.0001884170 0.0006905222 76.0859067227 0.273 0.78570
## Heart.Disease 0.0029318916 0.0016177739 123.3780570113 1.812 0.07237 .
## COPD -0.0001690159 0.0013332143 122.6208040977 -0.127 0.89933
## Smoking -0.0001961525 0.0002681704 137.4485276759 -0.731 0.46575
## Diabetes -0.0007569726 0.0006557853 125.0647336559 -1.154 0.25058
## No.Physical.Activity 0.0000170050 0.0002490208 136.4253821311 0.068 0.94566
## Obesity 0.0003824728 0.0002059209 162.0113460928 1.857 0.06507 .
## Poor.Sleeping.Habits 0.0000821281 0.0001864430 159.1835510998 0.440 0.66017
## Poor.Mental.Health -0.0000439918 0.0005607249 50.7989098929 -0.078 0.93777
## Testing_Rate 0.0000007266 0.0000002631 45.4737968502 2.762 0.00826 **
## Hospitalization_Rate -0.0001443769 0.0001160670 31.5818680263 -1.244 0.22269
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of fixed effects could have been required in summary()
##
## Correlation of Fixed Effects:
## (Intr) Afflnc Sng..T Snr..T A.A..T Nnc..T Hgh.BP Bng.Dr Cancer Asthma Hrt.Ds COPD Smokng Diabts N.Ph.A
## Affluence 0.012
## Sngltns.n.T 0.021 0.073
## Snrs.n.Trct 0.473 0.349 0.193
## Afrcn.Am..T 0.120 0.145 -0.388 0.145
## Nnctzns.n.T 0.006 0.124 0.041 0.094 -0.126
## High.BP -0.080 0.260 0.019 0.072 -0.068 0.343
## Bing.Drnkng -0.393 -0.123 -0.277 -0.120 0.063 -0.017 0.130
## Cancer -0.553 -0.102 0.214 -0.250 -0.077 -0.086 -0.336 -0.056
## Asthma -0.408 -0.097 -0.265 -0.208 0.081 0.093 0.119 0.038 0.034
## Heart.Dises -0.185 0.058 -0.312 -0.177 0.253 -0.138 0.058 0.069 -0.487 0.328
## COPD 0.576 0.009 0.162 0.267 -0.046 0.249 0.068 0.028 -0.252 -0.407 -0.585
## Smoking -0.104 0.109 -0.180 -0.127 -0.045 0.064 -0.035 -0.279 0.086 0.112 0.177 -0.471
## Diabetes 0.152 -0.384 -0.090 -0.196 -0.303 -0.236 -0.553 0.037 0.235 -0.143 -0.357 0.009 0.213
## N.Physcl.Ac -0.211 0.078 0.110 0.021 -0.016 -0.216 -0.007 0.121 0.443 0.065 -0.345 -0.014 -0.289 -0.168
## Obesity -0.024 0.382 0.478 0.287 0.105 0.166 -0.099 -0.187 0.123 -0.209 -0.093 0.150 -0.257 -0.370 0.000
## Pr.Slpng.Hb -0.406 -0.393 0.113 -0.325 -0.280 -0.071 -0.185 0.108 0.091 0.083 0.257 -0.157 -0.074 -0.033 -0.160
## Pr.Mntl.Hlt -0.367 0.225 -0.051 -0.030 0.070 -0.123 0.023 0.118 0.346 -0.258 0.078 -0.451 0.027 -0.011 0.006
## Testing_Rat 0.223 -0.151 0.022 0.011 0.010 -0.016 -0.042 -0.076 -0.155 -0.288 -0.098 0.242 0.089 0.156 -0.308
## Hsptlztn_Rt -0.124 -0.151 -0.076 -0.182 -0.029 -0.112 -0.031 -0.061 -0.053 0.054 0.168 -0.145 0.081 -0.011 -0.013
## Obesty Pr.S.H Pr.M.H Tstn_R
## Affluence
## Sngltns.n.T
## Snrs.n.Trct
## Afrcn.Am..T
## Nnctzns.n.T
## High.BP
## Bing.Drnkng
## Cancer
## Asthma
## Heart.Dises
## COPD
## Smoking
## Diabetes
## N.Physcl.Ac
## Obesity
## Pr.Slpng.Hb -0.136
## Pr.Mntl.Hlt 0.028 -0.132
## Testing_Rat 0.068 -0.108 -0.135
## Hsptlztn_Rt -0.020 0.015 -0.064 0.012
## fit warnings:
## Some predictor variables are on very different scales: consider rescaling
this.lme <- lmer("total.cases.percap ~ Affluence + Singletons.in.Tract + Seniors.in.Tract + African.Americans.in.Tract + Noncitizens.in.Tract + High.BP + Binge.Drinking + Cancer + Asthma + Heart.Disease + COPD + Smoking + Diabetes + No.Physical.Activity + Obesity + Poor.Sleeping.Habits + Poor.Mental.Health + (1 | stateID)", data = county.Demo_and_Covid.500counties)
print(summary(this.lme), correlation=TRUE)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method ['lmerModLmerTest']
## Formula:
## "total.cases.percap ~ Affluence + Singletons.in.Tract + Seniors.in.Tract + African.Americans.in.Tract + Noncitizens.in.Tract + High.BP + Binge.Drinking + Cancer + Asthma + Heart.Disease + COPD + Smoking + Diabetes + No.Physical.Activity + Obesity + Poor.Sleeping.Habits + Poor.Mental.Health + (1 | stateID)"
## Data: county.Demo_and_Covid.500counties
##
## REML criterion at convergence: -2395.8
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -3.7896 -0.4113 -0.0702 0.2584 6.2147
##
## Random effects:
## Groups Name Variance Std.Dev.
## stateID (Intercept) 0.000008384 0.002895
## Residual 0.000014772 0.003843
## Number of obs: 326, groups: stateID, 51
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) -0.0242281432 0.0085591614 190.4486855854 -2.831 0.00514 **
## Affluence 0.0033857735 0.0007807346 301.2023383302 4.337 0.0000198 ***
## Singletons.in.Tract 0.0007497921 0.0007305427 301.8816646785 1.026 0.30555
## Seniors.in.Tract 0.0011340713 0.0009224281 304.9422097450 1.229 0.21985
## African.Americans.in.Tract 0.0021170362 0.0008913340 307.1181995126 2.375 0.01816 *
## Noncitizens.in.Tract 0.0021911236 0.0007167987 268.9921062912 3.057 0.00246 **
## High.BP -0.0000007075 0.0001610522 297.0782045387 -0.004 0.99650
## Binge.Drinking 0.0004890458 0.0001682538 155.5748032181 2.907 0.00419 **
## Cancer -0.0007070639 0.0009431345 263.5580726158 -0.750 0.45411
## Asthma 0.0006892922 0.0005572237 138.9453295736 1.237 0.21817
## Heart.Disease 0.0035812565 0.0012074408 206.1209646479 2.966 0.00337 **
## COPD -0.0015154723 0.0009138581 201.1255142189 -1.658 0.09881 .
## Smoking -0.0000935179 0.0002116059 246.3524962279 -0.442 0.65892
## Diabetes -0.0013437789 0.0004538225 265.9802333166 -2.961 0.00334 **
## No.Physical.Activity 0.0002985958 0.0001820645 233.7039425336 1.640 0.10234
## Obesity 0.0003074292 0.0001480392 307.9983388253 2.077 0.03866 *
## Poor.Sleeping.Habits 0.0002452751 0.0001423300 296.1990565481 1.723 0.08588 .
## Poor.Mental.Health -0.0001774467 0.0004716551 102.0505983202 -0.376 0.70753
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of fixed effects could have been required in summary()
##
## Correlation of Fixed Effects:
## (Intr) Afflnc Sng..T Snr..T A.A..T Nnc..T Hgh.BP Bng.Dr Cancer Asthma Hrt.Ds COPD Smokng Diabts N.Ph.A
## Affluence -0.045
## Sngltns.n.T -0.058 0.044
## Snrs.n.Trct 0.399 0.293 0.074
## Afrcn.Am..T 0.243 0.076 -0.405 0.201
## Nnctzns.n.T -0.072 0.153 0.126 0.057 -0.188
## High.BP -0.096 0.156 0.099 0.007 -0.236 0.331
## Bing.Drnkng -0.485 -0.044 -0.206 -0.071 0.042 -0.076 0.150
## Cancer -0.496 -0.096 0.231 -0.175 -0.073 -0.068 -0.328 -0.022
## Asthma -0.266 -0.099 -0.262 -0.120 -0.011 0.210 0.056 0.005 -0.159
## Heart.Dises -0.057 0.074 -0.300 -0.132 0.212 -0.053 -0.004 0.034 -0.601 0.337
## COPD 0.479 0.013 0.126 0.174 -0.004 0.156 0.060 0.062 -0.214 -0.324 -0.489
## Smoking -0.046 0.105 -0.119 -0.136 -0.105 0.160 -0.083 -0.327 0.159 0.144 0.081 -0.476
## Diabetes 0.035 -0.300 -0.080 -0.134 -0.230 -0.257 -0.444 0.075 0.364 -0.106 -0.429 -0.012 0.279
## N.Physcl.Ac -0.115 0.033 0.100 0.079 0.060 -0.274 0.004 0.123 0.339 -0.025 -0.362 0.087 -0.274 -0.169
## Obesity -0.065 0.384 0.398 0.204 0.134 0.195 -0.104 -0.150 0.119 -0.129 -0.022 0.092 -0.220 -0.377 -0.046
## Pr.Slpng.Hb -0.386 -0.353 0.163 -0.327 -0.323 -0.045 -0.156 0.087 0.029 0.000 0.240 -0.094 -0.164 -0.059 -0.155
## Pr.Mntl.Hlt -0.355 0.182 -0.006 0.018 0.049 -0.167 0.025 0.131 0.418 -0.436 -0.068 -0.388 -0.027 0.073 -0.081
## Obesty Pr.S.H
## Affluence
## Sngltns.n.T
## Snrs.n.Trct
## Afrcn.Am..T
## Nnctzns.n.T
## High.BP
## Bing.Drnkng
## Cancer
## Asthma
## Heart.Dises
## COPD
## Smoking
## Diabetes
## N.Physcl.Ac
## Obesity
## Pr.Slpng.Hb -0.115
## Pr.Mntl.Hlt 0.027 -0.083
testing.data.state <- compiled.stats[[length(daily_filenames)]][, c("Province_State", "Testing_Rate")]
testing.data.state <- testing.data.state[!is.na(testing.data.state$Testing_Rate),]
testing.data.state <- testing.data.state[order(testing.data.state$Testing_Rate),]
col.state <- rep("pink", nrow(testing.data.state))
avg.test.rate <- mean(testing.data.state$Testing_Rate, na.rm = T)
col.state[testing.data.state$Testing_Rate < avg.test.rate] <- "grey"
col.state[testing.data.state$Province_State == "Oklahoma"] <- "lightblue"
par(mar = c(5,6,4,2))
barplot(testing.data.state$Testing_Rate, names.arg = testing.data.state$Province_State, horiz = T, main = "Testing Rate by State", las = 2, cex.axis = 1, cex.names = 0.5, col = col.state, border = F, xlab = "Total number of people tested per 100,000 persons.")
abline(v = avg.test.rate, col = "red")
text(x = avg.test.rate + 10, y = 1, labels = "Average Testing Rate", adj = c(0, 0.5), col = "red")
Pink highlights the last 14 days.
day.first.case <- min(which(US.total$cases.total > 100))
n.days <- nrow(US.total)
twoweek.col <- c(rep("grey", n.days-day.first.case-13), rep("pink", 14))
par(mar = c(5,5,4,2))
barplot(US.total$cases.total[day.first.case:n.days],
names = US.total$day[day.first.case:n.days],
main = "Total COVID-19 cases by Date in US",
las = 2, cex.axis = 1, cex.names = 0.5,
col = twoweek.col, border = F)
barplot(US.total$cases.total[day.first.case:n.days],
names = US.total$day[day.first.case:n.days],
main = "Total COVID-19 cases by Date in US, log scale",
las = 2, cex.axis = 1, cex.names = 0.5, log = "y",
col = twoweek.col, border = F)
barplot(US.total$deaths.total[day.first.case:n.days],
names = US.total$day[day.first.case:n.days],
main = "Total COVID-19 deaths by Date in US",
las = 2, cex.axis = 1, cex.names = 0.5,
col = twoweek.col, border = F)
barplot(US.total$deaths.total[day.first.case:n.days],
names = US.total$day[day.first.case:n.days],
main = "Total COVID-19 deaths by Date in US, log scale",
las = 2, cex.axis = 1, cex.names = 0.5, log = "y",
col = twoweek.col, border = F)
barplot(US.total$rise.cases.total[day.first.case:n.days],
names = US.total$day[day.first.case:n.days],
main = "Rise in Cases of COVID-19 by Date in US",
las = 2, cex.axis = 1, cex.names = 0.5,
col = twoweek.col, border = F)
barplot(US.total$rise.deaths.total[day.first.case:n.days],
names = US.total$day[day.first.case:n.days],
main = "Rise in Deaths of COVID-19 by Date in US",
las = 2, cex.axis = 1, cex.names = 0.5,
col = twoweek.col, border = F)